package study.bigdata.flink.spring;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

@Slf4j
public class SpringUtils {

    private static final AnnotationConfigApplicationContext CONTEXT = new AnnotationConfigApplicationContext(SpringBootCfg.class);

    private SpringUtils() {
    }

    public static <T> T getBean(Class<T> clazz) {
        return CONTEXT.getBean(clazz);
    }

    public static <T> T getBean(String beanName, Class<T> clazz) {
        return CONTEXT.getBean(beanName, clazz);
    }
}
